Vendor coding and cua templates under environments/ - #512
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ea60e77. Configure here.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ea60e77aee
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Bring the coding (v6 rebuild) and cua starter templates into the SDK repo as canonical examples of v6 environment authoring. Each is a standalone uv project with its own lockfile, Dockerfile, and tests. environments/* stays ignored except the vendored templates, so local scratch checkouts are unaffected. The templates are excluded from the built wheel/sdist; their nested ruff config keeps root lint isolated, and root pyright/pytest scoping already excludes them. Follow-ups: CI matrix running template tests against the local SDK, release-gate integrity runs, vendored hud init presets, and mirroring back to the standalone template repos.
ea60e77 to
76ffbed
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 76ffbed2f5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| env={"HOME": str(AGENT_HOME)}, | ||
| track_files=settings.file_tracking_enabled, | ||
| shell_uid=AGENT_UID, | ||
| require_isolation=not is_root, |
There was a problem hiding this comment.
Avoid requiring an unreleased Workspace keyword
When this standalone template is installed normally, its lockfile supplies HUD 0.6.11 and the declared range currently resolves at most to 0.6.12, but neither release accepts Workspace(require_isolation=...). Consequently _up() raises TypeError before serving any coding task; the tests only avoid this because they overlay the repository SDK checkout. Use only a released API or update and relock the dependency once the keyword is released.
Useful? React with 👍 / 👎.
| REMOTE_DIR = ( | ||
| Path(os.environ.get("REMOTE_DIR", "/srv/git/project.git")) | ||
| if _explicit_repo | ||
| else _LOCAL_ROOT / f"remote-{os.getpid()}" / "project.git" |
There was a problem hiding this comment.
Expose the mock remote inside the local sandbox
For the documented non-root local SDLC run, isolation is now mandatory, but Workspace binds only REPO_DIR and gives the sandbox a private /tmp; REMOTE_DIR is a sibling host path under /tmp/hud-coding/.... The repository's origin therefore points to a path that does not exist inside the agent shell, so the required git push origin cannot succeed and every local sdlc-task is unshippable. Mount the remote read-write at the same guest path (or otherwise expose it without exposing the vault).
Useful? React with 👍 / 👎.
| async def reset_worktree(repo: Path, setup_commit: str) -> None: | ||
| await git(repo, "reset", "--hard", setup_commit) | ||
| await git(repo, "clean", "-fd") |
There was a problem hiding this comment.
Restore ignored artifacts before running graders
When a repository has ignored runtime inputs such as a virtualenv, generated configuration, or compiled output, an agent can modify those files and have the modifications affect grading without including them in its captured diff or pushed PR: git add -A omits ignored paths, while git clean -fd deliberately preserves them. Thus generic, SDLC, and SWE grading can pass because of state that is absent from the submitted patch; preserve a protected pre-agent copy of ignored setup artifacts and restore it before testing.
Useful? React with 👍 / 👎.
| task = asyncio.create_task(server.run_async(transport="http", host="127.0.0.1", port=port, show_banner=False)) | ||
| return task, Capability.mcp(name="github", url=f"http://127.0.0.1:{port}/mcp") |
There was a problem hiding this comment.
Wait for the GitHub MCP server before publishing it
If the harness discovers tools immediately after environment initialization, the capability can be used before server.run_async() has bound the selected port because serve() returns as soon as it schedules the task. That race produces a connection refusal and leaves SDLC runs without their required github_* tools; wait until the port accepts connections, as the other in-repo FastMCP environments do, before returning the capability.
Useful? React with 👍 / 👎.

What
Brings the coding template (the v6 rebuild with diff-based grading) and the cua template into the SDK repo under
environments/, as canonical, in-repo examples of v6 environment authoring. Each is a standalone uv project with its own lockfile, Dockerfile, ruff config, and tests.This is step 1 of making the SDK repo the source of truth for starter templates: follow-up PRs add a CI matrix that runs each template's tests against the SDK checkout (so SDK PRs that break a template fail at the PR boundary), release-gate oracle/null integrity runs, vendored
hud initpresets, and a mirror action back to the standalone template repos for the platform flow.Repo integration
.gitignore:environments/becomesenvironments/*+ negations for the vendored templates, so untracked local environment checkouts stay ignored. Each template's own.gitignorere-includes itsuv.lock(the root ignore is repo-wide).pyproject.toml:environments/added to hatch build excludes; root pyright/pytest scoping already excludes it, and ruff picks up each template's nested[tool.ruff].hudpins aligned at>=0.6.11; standalone-repo tooling (pre-commit) dropped from dev extras.Verification
uv run pytestwith the local SDK installed editable over the pin — 20 passed, 1 skipped (test_integration.pyneeds a built SWE-bench Pro instance image).test_local_rollout.pycovers the full serve/connect/run/grade path (golden=1.0, baseline=0.0) against the checkout.ruff check .andruff format --check .clean.Known follow-ups in the templates (deliberate, not drive-by)
pytestis a runtime dep;fastmcpused but undeclared; a few dead-defensive branches and a test asserting a private helper.Note
Low Risk
Adds vendored example code under
environments/excluded from the main SDK package; no changes to core auth or runtime paths in this diff.Overview
Vendors the full HUD v6 coding environment into
environments/coding/as a self-contained uv project (lockfile, Dockerfile, tests, ruff config), alongside the existingcuatemplate. Root.gitignorenow ignoresenvironments/*but tracksenvironments/coding/andenvironments/cua/.The template implements diff-based grading with git history vaulting so agents never see answer-key refs:
coding/repo.pysnapshots, vaults.git, captures agent diffs, resets, and applies patches before hidden tests run.env.pywires an SSH workspace, three flavors —coding-task(generic bugs + hidden test refs),sdlc-task(mock GitHub MCP + PR branch grading), and SWE-bench Pro when instance assets are baked — plus sample rows intasks.py/swe_tasks.py.Dockerfile.hudsupports generic repo-clone images and instance overlays on prebuilt SWE images;swe_tasks.pyfetches dataset rows and builds per-instance images.Tests cover mock GitHub, SWE scoring/patch logic, hermetic local rollouts (golden vs baseline), optional Docker integration for built SWE images, and Dockerfile secret-handling smoke checks.
Reviewed by Cursor Bugbot for commit 76ffbed. Bugbot is set up for automated code reviews on this repo. Configure here.
HUD-2276